package com.ljkj.cordial.chat.activity;

import android.content.Context;
import android.content.Intent;
import android.widget.ListView;

import com.ljkj.cordial.chat.R;
import com.ljkj.cordial.chat.adapter.SysNotifyAdapter;
import com.ljkj.cordial.chat.base.BaseActivity;
import com.ljkj.cordial.chat.dao.DbController;
import com.ljkj.cordial.chat.dao.SysNoticeTableDao;
import com.ljkj.cordial.chat.dao.notify.SysNoticeTable;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 系统通知
 */
public class SysNotifyActivity extends BaseActivity {

    @BindView(R.id.listView)
    ListView listView;
    private List<SysNoticeTable> list;
    private SysNotifyAdapter sysNotifyAdapter;

    @Override
    public int getContentLayoutId() {
        return R.layout.activity_sys_notify;
    }

    @Override
    public void initView() {
        ButterKnife.bind(this);
        getToolbar().setTitle("系统通知");
        sysNotifyAdapter = new SysNotifyAdapter();
        listView.setAdapter(sysNotifyAdapter);
        SysNoticeTableDao sysDao = DbController.getInstance().getRead().getSysNoticeTableDao();
        List<SysNoticeTable> sysList = sysDao.queryBuilder().list();
        if (sysList != null && !sysList.isEmpty()) {
            sysNotifyAdapter.setList(sysList);
        }
    }

    public static void jumpTo(Context activity) {
        Intent intent = new Intent(activity, SysNotifyActivity.class);
        activity.startActivity(intent);
    }
}
